package com.lancoo.answer.util.paperUtils.fragmentUtils.ques;

import androidx.fragment.app.Fragment;

import com.lancoo.answer.model.bean.Child;
import com.lancoo.answer.model.bean.Ques;
import com.lancoo.answer.ui.ques.NoSpliteLayoutFragment;
import com.lancoo.answer.ui.ques.SpliteLayoutFragment;
import com.lancoo.answer.view.fragment.correctmistake.PracticeCorrectMistakesFragment;
import com.lancoo.answer.view.fragment.cloze.ClozeFragment;
import com.lancoo.answer.view.fragment.option.OptionFragment;
import com.lancoo.answer.view.fragment.paragraphSort.ParagraphSortingFragment;
import com.lancoo.answer.view.fragment.readMatch.ReadMatchFragment;

/**
 * Created by pengmi on 2022/2/20 11:49
 * Description:大题可作答状态状态fragment加载
 */
public class QuesTrainingingFragmentUtils {

    public static Fragment loadQuesTrainingFragment(Ques ques,
                                                    int typeIndex,
                                                    int quesIndex,
                                                    int defaultLoadIndex,int defaultLoadChildIndex,
                                                    int defaultLoadItemIndex){
        String genreID=ques.getGenreID();
        String typeNo=ques.getTypeNo();
        Child child=ques.getChildList().get(0);
        switch (typeNo) {
            case "U"://改错题
                return PracticeCorrectMistakesFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            case "V"://连词成句
                return NoSpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
        }
        switch (genreID) {
            case "15"://词汇匹配
            case "17"://短文匹配
                return OptionFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadChildIndex,defaultLoadItemIndex);
            case "62"://完型填空
                return ClozeFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            case "13"://单选题
            case "14"://翻译选择
            case "32"://单词辨音
            case "33"://词义辨析
            case "21"://句子填空
            case "38"://句子英译中
            case "40"://句子中译英
            case "25"://英译中
            case "26"://中译英
            case "22"://翻译填空
            case "VD"://词汇听写
            case "98"://看情景写句子
            case "99"://看图写句子
            case "107"://词汇翻译
                return NoSpliteLayoutFragment.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            case "42"://阅读匹配
                return ReadMatchFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            case "43"://段落排序
            case "45"://多项对应
                return ParagraphSortingFragment.Companion.loadFragment(typeIndex, quesIndex, defaultLoadIndex);
            default:
                return SpliteLayoutFragment.loadFragment(typeIndex, quesIndex,defaultLoadChildIndex,defaultLoadItemIndex);
        }
    }
}
